package cloud.xlh.digital_power_order.intergration.order.adapter;

import cloud.xlh.digital_power_order.client.order.dto.GenOrderReqDTO;
import cloud.xlh.digital_power_order.client.order.dto.RefundOrderReqDTO;
import cloud.xlh.digital_power_order.domian.order.OrderSaveDomain;
import cloud.xlh.digital_power_order.domian.order.OrderUpdateDomain;
import cloud.xlh.infrastructure.utils.CommonUtil;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 *
 * @ project name : xlh_osms
 * @ Author: XuLeHuang
 * @ Date: 2023/8/12 18:10
 * @ Description:
 */
@Component
public class OrderClientAdapter {
    public OrderSaveDomain convertOrderSaveDomain(GenOrderReqDTO genOrderReqDTO) {
        OrderSaveDomain orderSaveDomain = new OrderSaveDomain();
        CommonUtil.copyPropertiesIgnoreCase(genOrderReqDTO , orderSaveDomain);
        return orderSaveDomain;
    }

    public OrderUpdateDomain convertOrderUpdateDomain(RefundOrderReqDTO refundOrderReqDTO) {
        OrderUpdateDomain orderUpdateDomain = new OrderUpdateDomain();
        CommonUtil.copyPropertiesIgnoreCase(refundOrderReqDTO , orderUpdateDomain);
        return orderUpdateDomain;
    }
}
